package com.qf.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.pojo.DtsUser;
import com.qf.vo.DayStatis;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */
public interface DtsUserMapper extends BaseMapper<DtsUser> {

    /**
     * 统计最近多少天内用户的增长量
     * @return
     */
    @Select("SELECT DATE_FORMAT(a.add_time,\"%Y-%m-%d\") as dayStr , count(*) as cnts " +
            "FROM dts_user a " +
            "where a.deleted=0 " +
            "GROUP BY DATE_FORMAT(a.add_time,\"%Y-%m-%d\")")
    public List<DayStatis> staticIncreaseUser();

    /**
     * 查询会员信息
     * @return
     */
    @Select("SELECT a.id,a.username,a.mobile, " +
            "a.gender,a.birthday,a.user_level,a.`status` " +
            "from dts_user a ")
    public IPage<DtsUser> selectVipList(IPage iPage , QueryWrapper queryWrapper);

    /**
     * 审核数据
     * @param queryWrapper
     */
    @Update("")
    public void update(QueryWrapper queryWrapper);

}
